<?php

namespace App\Http\Controllers\Web\V1;

use App\Http\Controllers\Controller;
use App\Models\Integral;
use App\Models\User;
use App\Transformers\Web\IntegralTransformer;

class IntegralController extends Controller
{
    /**
     * 获取积分列表
     */
    public function index()
    {
        $data = Integral::query()
            ->where('user_id', $this->adminUser()->id())
            ->select('id', 'examination_id', 'this_integral', 'get_time')
            ->with('examination:id,type,subject_id')
            ->get();

        return $this->response->collection($data, new IntegralTransformer());
    }

}
